import logging
#loggin默认打印warning及以上的日志
import time

logging.basicConfig(filename='logdemo.log',
                    level=logging.INFO,
                    format='%(asctime)s [%(levelname)s] %(message)s (%(filename)s:%(lineno)s)',
                    datefmt='%Y-%m-%d %H:%M:%S')

#在文件最开始设置打印级别
logging.warning('Watch out')
logging.info('I told you so')
logging.error('error')

